package gui;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Point;
import java.awt.Toolkit;

import dal.FileIO;
import dal.object.*;
import dal.object.rocks.*;
import dal.object.grounds.*;
import dal.object.tools.*;

//This class contains only static predefined field for easy coding
public class GameConstants {
	public static Color COMPONENT_COLOR = new Color(149, 147, 100);
	public static Color COMPONENT_BORDER = new Color(123, 121, 83);
	public static Color COMPONENT_TEXT = new Color(32, 31, 23);
	public static Color COMPONENT_COLOR_PRESSED = new Color(185, 184, 125);
	public static Color COMPONENT_BORDER_OVER = new Color(62, 61, 40);
	public static Color COMPONENT_TEXTBOX = COMPONENT_COLOR_PRESSED;
	public static Color COMPONENT_ACTIVE_TEXTBOX = new Color(222, 229, 164);
	public static Color COMPONENT_TEXTBOX_BORDER = new Color(153, 151, 83);
	public static Color CONTAINER_BORDER = COMPONENT_BORDER_OVER;
	public static Color PANEL_COLOR = new Color(197, 196, 131);
	public static Color MAIN_PANEL_BACKGROUND = new Color(91, 88, 66);
	
	/** MapObject image dimensions */
	public static final int picWidth100 = 38;
	public static final int picHeight100 = 44;
	public static final int picWidth50 = picWidth100 >> 1;
	public static final int picHeight50 = picHeight100 >> 1;
	public static final int picHeight25 = picHeight50 >> 1;
	public static final int picHeight75 = picHeight100 - picHeight25;
	
	/** Drawer layers */
	public static final int TOOL_CONTAINER_LAYER = 6;
	public static final int HOVER_LAYER = 5;
	public static final int ROCK_LAYER = 4;
	public static final int TOOL_LAYER = 3;
	public static final int BALL_LAYER = 2;
	public static final int SHADOW_LAYER = 1;
	public static final int GROUND_LAYER = 0;
	
	/** List of the existing types. */
	public static final Ball[] BALL_LIST = {new Ball()};
	public static final Attacker[] ATTACKER_LIST = {};
	public static final Rock[] ROCK_LIST = {new BlackCardRock(), new BlueCardRock(), new GreenCardRock(), new HeliumRock(), 
		new RedCardRock(), new WhiteCardRock(), new YellowCardRock(), new HidrogenRock(), new Invisible(), new GranitRock(), new MarbleRock()};
	public static final Ground[] GROUND_LIST = {new BigPile(), new BigPit(), new Grass(), new Ice(), 
		new Sand(), new SinkedHelium(), new SinkedHidrogen(), new SmallPile(), new SmallPit(), new Space(), new Water()};
	public static final Tool[] TOOL_LIST = {new Brush(), new Life(), new Umbrella()};
	
	/**
	 * @param j
	 *	horizontal cell index 
	 * @param i
	 * 	vertical cell index 
	 * @return
	 * 	the object x location in a panel
	 */
	public static int getXbyIndex(int j, int i) {
		return picWidth100 * j + ((i & 1) == 1 ? picWidth50 : 0);
	}
	
	/**
	 * @param i
	 * 	vertical cell index 
	 * @return
	 * 	the object y location in a panel
	 */
	public static int getYbyIndex(int i) {
		return picHeight75 * i;
	}
	
	public static final Cursor INVISIBLE_CURSOR = Toolkit.getDefaultToolkit().
		createCustomCursor(FileIO.readPic("pic/invisible.png"), new Point(16, 16), "invisible");
}